d02raf

d02raf © Numerical Algorithms Group, 2002.

Purpose

D02RAF ODEs, general nonlinear boundary value problem, finite difference technique with deferred correction, continuation facility

Synopsis

[x,abt,y,np,deleps,ifail] = d02raf(n,numbeg,nummix,tol,x,fcn,g,jacobf,...
jacobg,jaceps,jacgep<,y,np,ijac,deleps,init,mnp,ifail>)

Description

 
 D02RAF solves a two-point boundary-value problem for a system of 
 n ordinary differential equations in the interval (a,b) with b>a.
 The system is written in the form
 
             y '=f (x,y ,y ,...,y ) , i=1,2,...,n              (1)
              i   i    1  2      n                           
 
 and the derivatives f  are evaluated by a subroutine FCN supplied
                      i                                   
 by the user. With the differential equations (1) must be given a 
 system of n (nonlinear) boundary conditions
 
                   g (y(a),y(b))=0 , i=1,2,...,n
                    i
 
 where
 
                                            T                
                y(x)=[y (x),y (x),...,y (x)] .                 (2)
                       1     2         n                     
 
 The functions g  are evaluated by a subroutine G supplied by the 
                i                                                
 user. The solution is computed using a finite-difference 
 technique with deferred correction allied to a Newton iteration 
 to solve the finite-difference equations. 

 The user must supply an absolute error tolerance and may also 
 supply an initial mesh for the finite-difference equations and an
 initial approximate solution (alternatively a default mesh and 
 approximation are used). The approximate solution is corrected 
 using Newton iteration and deferred correction. Then, additional 
 points are added to the mesh and the solution is recomputed with 
 the aim of making the error everywhere less than the user's 
 tolerance and of approximately equidistributing the error on the 
 final mesh. The solution is returned on this final mesh.
 
 If the solution is required at a few specific points then these 
 should be included in the initial mesh. If, on the other hand, 
 the solution is required at several specific points then the user
 should use the interpolation routines provided in Chapter E01 if 
 these points do not themselves form a convenient mesh.
 
 The Newton iteration requires Jacobian matrices
 
                 ( ddf )  (  ddg   )     (  ddg   )
                 (    i)  (     i  )     (     i  )
                 ( ----), ( -------) and ( -------).
                 ( ddy )  ( ddy (a))     ( ddy (b))
                 (    j)  (    j   )     (    j   )
 
 These may be supplied by the user through subroutines JACOBF for 
 ( ddf )                                                       
 (    i)                                                       
 ( ----) and JACOBG for the others. Alternatively the Jacobians 
 ( ddy )                                                       
 (    j)                                                       
 may be calculated by numerical differentiation.
 
 For problems of the type (1) and (2) for which it is difficult to
 determine an initial approximation from which the Newton 
 iteration will converge, a continuation facility is provided. The
 user must set up a family of problems
 
       y'=f(x,y,(epsilon)),   g(y(a),y(b),(epsilon))=0,        (3)
 
                       T                              
 where f=[f ,f ,...,f ]  etc, and where (epsilon) is a 
           1  2      n                                
 continuation parameter. The choice (epsilon)=0 must give a 
 problem (3) which is easy to solve and (epsilon)=1 must define 
 the problem whose solution is actually required. The routine 
 solves a sequence of problems with (epsilon) values
 
          0=(epsilon) <(epsilon) <...<(epsilon) =1.            (4)
                     1          2              p             
 
 The number p and the values (epsilon)  are chosen by the routine 
                                      i                          
 so that each problem can be solved using the solution of its 
                                                         ddf    
 predecessor as a starting approximation. Jacobians  ----------- 
                                                     dd(epsilon)
          ddg                                                 
 and  ----------- are required and they may be supplied by the 
      dd(epsilon)                                             
 user via routines JACEPS and JACGEP respectively or may be 
 computed by numerical differentiation.
 

Parameters

d02raf

Required Input Arguments:

n                                     integer
numbeg                                integer
nummix                                integer
tol                                   real
x (mnp)                               real
fcn                                   function (User-Supplied)
g                                     function (User-Supplied)
jacobf                                function (User-Supplied)
jacobg                                function (User-Supplied)
jaceps                                function (User-Supplied)
jacgep                                function (User-Supplied)

Optional Input Arguments:                       <Default>

y (:,mnp)                             real     zeros(n,mnp)
np                                    integer  17
ijac                                  integer  1
deleps                                real     0
init                                  integer  d02raf07(y)
mnp                                   integer  max(length(x),32)
ifail                                 integer  -1

Output Arguments:

x (mnp)                               real
abt (n)                               real
y (:,mnp)                             real
np                                    integer
deleps                                real
ifail                                 integer